import camctrl

class CamControls():
  
  def __init__(self, devpath, no_reset=False):
    self.opendev(devpath)
    if self.dev <= 0: print "FAILED TO OPEN DEVICE DESCRIPTOR"
    if not no_reset: self.reset()
    
  def opendev(self,path):
    self.dev = camctrl.opendev(path)
    
  def reset(self):
    return camctrl.reset(self.dev)
  
  def pan(self, steps):
    return camctrl.pan(self.dev, steps)
  
  def tilt(self, steps):
    return camctrl.tilt(self.dev, steps)
  
  def pantilt(self, psteps, tsteps):
    return camctrl.pantilt(self.dev, psteps, tsteps)
  
  def focus(self, value):
    if(0 <= value <= 255):
      return camctrl.focus(self.dev, value)
    
